#include "ListsManager.h"

ListsManager::ListsManager(){
}

void ListsManager::addList(Todolist* todo) {
    this->lists.push_front(todo);
}

Todolist* ListsManager::getTodo(int position){
    if(position > this->lists.size() || position < 1) {
        cout << "This list does not exists!" << endl;
    }
    else {
        list<Todolist*>::iterator it;
        it = this->lists.begin();
        advance(it,position-1);
        return *it;
    }
}

/*void deleteList(int position);
void save(string filePath);
void load(string filePath);*/

void ListsManager::toString() {
    if(this->lists.empty()) {
        cout << "There is no todolist to display" << endl;
    }
    else {
        list<Todolist*>::iterator it;
        int i = 0;
        for(it = this->lists.begin(); it != this->lists.end(); it++){
            i++;
            cout << i << ". " << (*it)->getName() << endl;
        }
    }
}
